//
//  UIBarButtonItem+Extension.swift
//  Weibo(Swift)
//
//  Created by 肖霆 on 16/5/11.
//  Copyright © 2016年 肖霆. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    convenience init(title:String,fontSize:CGFloat,target:AnyObject?,action:Selector?) {
        self.init()
        let btn = UIButton()
        btn.addTarget(target, action: action!, forControlEvents: .TouchUpInside)
        btn.setTitle(title, forState: .Normal)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        btn.titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        
        btn.sizeToFit()
        customView = btn
    }

}
